<?php
require("../../../class2.php");
require("../library/admin/adminapi.php");

if(!getperms("P")){header("location:".e_BASE."index.php"); exit; }
$e_wysiwyg = "cat_description";
require_once(e_ADMIN."auth.php");

// Include userclass_class.php which is necessary for function r_userclass (dropdown of classes)
require_once(e_HANDLER."userclass_class.php");

//
// Process the Form
//
if($_POST["subbed"])
{
    e107shop_admin_process_category($_POST["faction"], $_POST["catid"], $_POST["cat_image"], 
    $_POST["cat_name"], $_POST["cat_order"], $_POST["cat_description"], $_POST["parent_cat"], 
    $_POST["active"], $_POST["items"], $_POST["category_class"], $_POST["category_order_class"]);
}

// If there is a delete-action, process it BEFORE loading the categories
if($_GET['a'] == 2) {
        $sql->db_Delete($e107shop_db_name['categories'], "catId=".$_GET['p']);
        $ns->tablerender("<center>".lan_global_status."</center>", 
        "<center><br />".lan_admin_del_c_text."</center>");
}


$ns->tablerender("<center>".lan_admin_menu_categories."</center>", 
e107shop_display_category_list2());

//
// Display the form
//
e107shop_manage_categories($_GET["a"], $_GET["p"]);

require_once(e_ADMIN."footer.php");
